<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var sum1 = 0;
        for (var i = 2; i <= 50; i += 2) {
            sum1 = sum1 + i;
        }
        alert("for循环结果为" + sum1);

        var sum2 = 0;
        var p = 0;
        while (p <= 50) {
            sum2 += p;
            p += 2;
        }
        alert("while循环结果为" + sum2);
    </script>
</head>

<body>

</body>

</html>